import http from "@/common/http";
import coupon from "@/apis/mock/coupon.json";
import {Coupon} from "@/common/interfaces/sms";

export async function queryCoupon(params?: any, useMock?: boolean) {
  if (useMock) {
    return Promise.resolve(coupon)
  }
  return http('/api/sms/coupon/list', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeCoupon(params: { ids: number[] }) {
  return http('/api/sms/coupon/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function addCoupon(params: Coupon) {
  return http('/api/sms/coupon/add', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function updateCoupon(params: Coupon) {
  return http('/api/sms/coupon/update', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
